package st.business.tepth.business.taskallocation.lag;

import java.util.ArrayList;
import java.util.List;

import st.business.tepth.business.bean.LagInfoBean;
import st.business.tepth.config.ItemFields;
import st.shadow.library.ui.recycler.MultipleItemEntity;

/**
 * @author zhangyu
 * @date 2019/6/13
 */
public class DataConvert {
    public List<MultipleItemEntity> convertList(List<LagInfoBean> lagInfoBeans) {
        List<MultipleItemEntity> list = new ArrayList<>();
        if (lagInfoBeans != null) {
            for (int i = 0, size = lagInfoBeans.size(); i < size; i++) {
                LagInfoBean lagInfoBean = lagInfoBeans.get(i);
                list.add(MultipleItemEntity.builder()
                        .setField("name", lagInfoBean.getName())
                        .setField("count", lagInfoBean.getCount())
                        .setField("checked", i == 0)
                        .setField(ItemFields.ITEM_OBJ,lagInfoBean)
                        .build());
            }
        }
        return list;
    }
}
